<?php
PageUtil::addVar("stylesheet","<link href=\"".$stylepath."/category.css\" rel=\"stylesheet\">");
?>
<div class="content_block col-xs-12 col-sm-12 col-md-12 col-lg-12">
  <form method="post" action="<?php echo base_url("admin/forum/addcategory");?>" class="form-horizontal" role="form">
    <fieldset>
      <h2>จัดหมวดหมู่</h2>
      <?php 
        if ($this->uri->segment(4) === FALSE){
      ?>
      <div class="form-group">
        <label class="col-lg-4 control-label" for="Username">หมวดหมู่หลัก</label>
        <div class="col-lg-4">
          <select name="parent_id" class="form-control">
            <option value="0">โปรดเลือก</option>
            <?php
              echo Util::buildCategoriesOptionList(0,$categories);
              
            ?>
          </select>
        </div>
      </div>
      <?php
    }else{
    ?>
      <div class="form-group">
        <label class="col-lg-4 control-label" for="Username">หมวดหมู่หลัก</label>
        <div class="col-lg-4">
          <select name="parent_id" class="form-control">
            <option value="0">โปรดเลือก</option>
            <?php
              echo Util::buildCategoriesOptionList(0,$categories,"",$this->uri->segment(4));
            ?>
          </select>
        </div>
      </div>
      <?php
      }
      ?>
      <div class="form-group">
        <label class="col-lg-4 control-label" for="Username">เลือกชื่อ Tag</label>
        <div class="col-lg-4">
          <select name="tag_id" class="form-control">
            <option value="0">โปรดเลือก</option>
            <?php  foreach ($tags as $tag) {
              ?>
              <option value="<?php echo $tag['id']; ?>">
                <?php echo $tag['name']; ?>
              </option>
              <?php  } ?>

          </select>
        </div>
      </div>

      <div class="form-group">
        <label class="col-lg-4 control-label" for="Username">หรือ</label>
      </div>

      <div class="form-group">
        <label class="col-lg-4 control-label" for="Username">ชื่อแท็ก</label>
        <div class="col-lg-6">
          <textarea name="tag_name" rows="10" class="form-control"></textarea>
          <small>1 แถวต่อ 1 Tag</small>
        </div>
      </div>

      <div class="form-group">
        <div class="col-lg-8">
          <input type="submit" name="submit" value="submit" class="btn btn-primary" >
          <input type="reset" name="cancel" value="cancel" class="btn" >
        </div>
      </div>

  </fieldset>
  </form>
</div>
